/**
 * comment
 */
package org.hawk.gwt.ppc;

import org.hawk.gwt.ppc.utils.AntPattern;
import org.hawk.gwt.ppc.utils.Pattern;

/**
 * Holds all methods to access environment configuration.
 * 
 * @author alex.bereznevatiy@gmail.com
 */
public interface Configuration {
	
	/**
	 * Parameter name for reflection pattern
	 */
	String REFLECTION_PARAMETER = "reflect";
	
	/**
	 * Parameter name for preprocessing parameter.
	 */
	String PREPROCESS_PARAMETER = "process";
	
	/**
	 * Parameter name for pattern type 
	 * @see #JAVA_PATTERN_TYPE
	 * @see #ANT_PATTERN_TYPE (default value)
	 */
	String PATTERN_PARAMETER = "pattern";
	
	/**
	 * Parameter name to control preprocessed sources.
	 * Default is <code>false</code> for command line invocation and
	 * <code>true</code> for Maven build.
	 */
	String KEEP_PREPROCESSED_SOURCES_PARAMETER = "keep-preprocessed-sources";
	
	/**
	 * Parameter name for generic preprocessor turn on/off.
	 */
	String GENERIC_SUPPORT_PARAMETER = "use-generics";
	
	/**
	 * Parameter name for annotation processing turn on/off.
	 */
	String PROCESS_ANNOTATIONS_PARAMETER = "process-annotations";
	
	/**
	 * THis parameter points to the output directory of the build system.
	 */
	String WAR_DIR_PARAMETER = "-war";
	
	/**
	 * Version of engine.
	 */
	String PREPROCESSOR_VERSION = "0.6";
	
	/**
	 * Pattern type for java-style patterns.
	 * @see java.util.Pattern
	 */
	String JAVA_PATTERN_TYPE = "java";
	
	/**
	 * Pattern type for ant style patterns.
	 * @see org.hawk.gwt.ppc.utils.AntPattern
	 */
	String ANT_PATTERN_TYPE = "ant";
	
	/**
	 * @param name
	 * @return value of parameter with name specified or <code>null</code>
	 * if parameter doesn't exists.
	 */
	String get(String name);
	
	/**
	 * 
	 * @param <T>
	 * @param name
	 * @param defaultValue
	 * @return value of parameter with name specified or defaultValue
	 * if parameter doesn't exists.
	 */
	<T> T get(String name,T defaultValue);
	
	/**
	 * Creates new pattern based on configuration.
	 * Default pattern is {@link AntPattern}.
	 * @param p
	 * @return new instance of pattern.
	 */
	Pattern getNewPattern(String p);

	/**
	 * @return list of GWT modules names to be compiled.
	 */
	String[] getModules();
}
